//
//  YSTransitionViewController.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSTransitionViewController.h"
#import "YSTransition2ViewController.h"
#import "YSBubbleTransition.h"

@interface YSTransitionViewController ()

@end

@implementation YSTransitionViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:true animated:true];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:false animated:true];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];

    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    button.center = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetMaxY(self.view.frame) - 60);
    button.layer.cornerRadius = 25.0f;
    button.backgroundColor = [UIColor colorWithRed:189/255.0 green:79/255.0 blue:70/255.0 alpha:1];
    [button addTarget:self action:@selector(pushMethod) forControlEvents:UIControlEventTouchUpInside];
    [button setImage:[UIImage imageNamed:@"Menu_icn"] forState:UIControlStateNormal];
    [self.view addSubview:button];

    //在ViewControllerA中添加push和pop的动画
    self.ys_pushTranstion = [YSBubbleTransition transitionWithAnchorRect:button.frame];
    self.ys_popTranstion  = [YSBubbleTransition transitionWithAnchorRect:button.frame];

}

- (void)pushMethod{
    YSTransition2ViewController *vcB = [[YSTransition2ViewController alloc] init];
    [self.navigationController pushViewController:vcB animated:true];
}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.navigationController popViewControllerAnimated:true];
}

@end
